/* 
 * This file is part of the Coffee Survey Framework - http://coffee.codeplex.com
 */
using System;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.Xml;
using Coffee;
using Coffee.SurveyControls;

/// <summary>
/// Summary description for TextControl
/// </summary>
public class TextControl : SurveyControl
{

    // REQUIRED: Constructor - just calls the base class that sets up coffee and configuration
    public TextControl(SurveyManager coffee, XmlNode configuration)
        : base(coffee, configuration)
    {
    }
    protected HtmlTable tbl = new HtmlTable();
    public override void Initialize()
    {
        tbl.Width = "100%";

        HtmlTableRow r = new HtmlTableRow();
        HtmlTableCell c1 = new HtmlTableCell();

        Label l1 = new Label();
        string text = configuration.SelectSingleNode("configuration/text").InnerXml;
        text = text.Replace("@lastyear", (DateTime.Today.Year - 1).ToString()).Replace("@currentyear", DateTime.Today.Year.ToString());
        l1.Text = text;
        c1.Controls.Add(l1);

        r.Cells.Add(c1);
        tbl.Rows.Add(r);

        this.Controls.Add(tbl);
    }
}
